import java.util.Arrays;

//TIP To <b>Run</b> code, press <shortcut actionId="Run"/> or
// click the <icon src="AllIcons.Actions.Execute"/> icon in the gutter.
public class Main {
    public static void main(String[] args) {

        int[] array = {1, 2, 3, 4, 5, 6};
        //数组遍历

        /*for(int i = 0;i < array.length;i++){
            System.out.print(array[i] + " ");
        }
        System.out.println();


        for(int x:array){
            System.out.print(x + " ");
        }
        System.out.println();*/

        //数组转字符串
        /*System.out.println(Arrays.toString(array));
        System.out.println(Arrays.toString(array));*/

        //数组的拷贝
        /*int[] copy = new int[array.length];
        for(int i = 0;i < array.length;i++){
            copy[i] = array[i];
        }
        System.out.println(Arrays.toString(copy));

        //方法二
        int[] copy2 = Arrays.copyOf(array,array.length*2);
        System.out.println(Arrays.toString(copy2));
        int[] copy3 = Arrays.copyOfRange(array,1,3);
        System.out.println(Arrays.toString(copy3));

        //方法三
        int[] copy4 = new int[array.length];
        System.arraycopy(array,0,copy4,0,array.length);
        System.out.println(Arrays.toString(copy4));

*/
    }
}
